package com.dailyblue.project.estate.controller;

import com.dailyblue.project.estate.commons.bean.EstateManager;
import com.dailyblue.project.estate.commons.util.JsonResult;
import com.dailyblue.project.estate.service.ManagerService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther:Liu
 * @Testname:ManagerController
 * @Date:2025/9/18 15:43
 */
@RestController
@RequestMapping("/manager")
public class ManagerController {
    @Resource
    private ManagerService managerService;

    @PostMapping
    JsonResult saveManager(EstateManager estateManager) {
        return managerService.saveManager(estateManager);
    }

    @GetMapping("/{id}")
    JsonResult findOne(@PathVariable("id") String id) {
        return managerService.findOne(id);
    }

    @GetMapping
    JsonResult findAll() {
        return managerService.findAll();
    }

    @DeleteMapping("/{id}")
    JsonResult deleteOne(@PathVariable("id") String id) {
        return managerService.deleteOne(id);
    }

    @PutMapping
    JsonResult updateOne(@RequestBody EstateManager estateManager) {
        return managerService.updateOne(estateManager);
    }
}
